package com.frame.pageform.component.validata;

import java.awt.Color;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ValidateNumberDisturber {

	private List disturberlist=new ArrayList();
	public ValidateNumberDisturber(){
		disturberlist.add(new Color(255,255,255));//白色
		disturberlist.add(new Color(255,0,0));//红色
		disturberlist.add(new Color(58,58,58));//黑色
		disturberlist.add(new Color(0,168,0));//绿色
	}
	public void disturber(Graphics2D g,int width,int height){
		Random random = new Random();
		for(int i=0;i<155;i++){
			Color gcol=(Color)disturberlist.get(random.nextInt(disturberlist.size()));
			g.setColor(gcol);
			int x = random.nextInt(width*20);
			int y = random.nextInt(height);
			int xl = random.nextInt(12);
			int yl = random.nextInt(12);
			g.drawLine(x,y,x+xl,y+yl);
		}
	}
	public void disturber2(Graphics2D g,int width,int height){
		Random random = new Random();
		for(int i=0;i<155;i++){
			Color gcol=(Color)disturberlist.get(random.nextInt(2));
			g.setColor(gcol);
			int x = random.nextInt(width*20);
			int y = random.nextInt(height);
			int xl = random.nextInt(12);
			int yl = random.nextInt(12);
			g.drawLine(x,y,x+xl,y+yl);
		}
	}
}
